package com.ask.mapper;

import com.ask.dto.DishQueryDTO;
import com.ask.entity.Dish;
import com.ask.vo.DishVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Mapper
public interface DishMapper {
//    @Insert("insert into dish (name, category_id, price, image, description, create_time, update_time, create_user, update_user) VALUES " +
//            "(#{name}, #{categoryId}, #{price}, #{image}, #{description}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
    void insert(Dish dish);

    void getByIdWithFlavor(Long id);

    @Select("select * from dish where id = #{id}")
    Dish getById(Long id);

    Page<DishVO> pageQuery(DishQueryDTO dishQueryDTO);

    @Select("select * from dish where category_id = #{categoryId}")
    List<Dish> getByCategory(Long categoryId);

    /**
     * 获取所有菜品（条件查询）
     * @param dish
     * @return
     */
    List<Dish> list(Dish dish);



    void update(Dish dish);

    void deleteBatch(List<Long> ids);

    Integer countByMap(Map map);

   List<Dish> getByIds(List<Long> ids);

    List<Dish> listByCategoryIds(Set<Long> categoryIds);

    List<Dish> getHotDishes(int count, Set<Long> excludeIds);

    List<Dish> listByCategoryIdsAndExcludeDishIds(Set<Long> categoryIds, Set<Long> dishIds);
}
